package day06;

import java.util.Random;
import java.util.Scanner;

public abstract class GuessGame {
    public void start(){
        // 产生随机值
        // 作为通用方法
        String r = genRandom();
        System.out.println(r);
        //显示提示
        hint();
        while(true){
            System.out.print("猜：");
            String c = new Scanner(System.in).nextLine();
            //比较c和r,并得到比较结果
            String result = compareResult(c, r);
            System.out.println(result);
            //判断是否猜对的结果
            if(guessRight(result)){
                break;
            }
        }

    }

    public abstract String genRandom();
    public abstract void hint();
    public abstract String compareResult(String c, String r);
    public abstract boolean guessRight(String result);

    


}
